package com.todo.delicacy.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/17 21:47
 * @description
 */
@Getter
@AllArgsConstructor
public enum RestaurantTypeEnum {

    RESTAURANT_CHAIN(1, "RESTAURANT_CHAIN", "连锁饭店"),
    LOCAL_CUISINE(2, "LOCAL_CUISINE", "地方菜馆"),
    STAR_RESTAURANT(3, "STAR_RESTAURANT", "星级餐厅"),
    POJANGMACHA(4, "POJANGMACHA", "流动餐馆"),
    INFLUENCE_RESTAURANT(5, "INFLUENCE_RESTAURANT", "网红饭店"),
    TIME_HONORED_RESTAURANT(6, "TIME_HONORED_RESTAURANT", "本地老店"),

    ;

    private static Map<Integer, RestaurantTypeEnum> typeMap = Arrays
            .stream(RestaurantTypeEnum.values())
            .collect(Collectors.toMap(RestaurantTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static RestaurantTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
